Release 10.1A: OpenEdge Development:
Progress 4GL Handbook
Using FOR FIRST versus FIND
The
FINDstatement retrieves a single record in a single statement. It has its limitations, however, when compared to aFORblock. AFINDstatement always uses only one index and does not allow use of field lists or word indexes. By contrast, aFORblock can use multiple indexes to evaluate a complexWHEREclause that involves fields not found in a single index. AFORblock can also use a word index and theCONTAINSkeyword to locate records, and supports the use of a field list to retrieve only a subset of the fields from the selected records. Both word indexes and field lists are briefly described in the "Using indexes properly" section and the "Defining efficient queries and FOR EACH statements" section. You can use the formFOR FIRSTwhen fetching just a single record, if any of the conditions apply that would give it a performance advantage. Of course, theFOR FIRSTconstruct involves creating a block, which has an overhead of its own that theFINDstatement doesn’t have. Therefore, it’s good practice not to useFOR FIRSTin all cases unless you have a specific reason.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |